<template>
    <div>
      <h1>Repository: {{ repositoryName }}</h1>
      <ul>
        <li v-for="commit in commits" :key="commit.id">
          <p>Message: {{ commit.message }}</p>
          <p>Author: {{ commit.authorName }} &lt;{{ commit.authorEmail }}&gt;</p>
          <p>Date: {{ commit.committedDate }}</p>
        </li>
      </ul>
    </div>
  </template>
  
  <script>
  import axios from 'axios';
  export default {
    data() {
      return {
        repositoryName: '',
        commits: []
      };
    },
    created() {
      this.fetchRepositoryStatus();
    },
    methods: {
      fetchRepositoryStatus() {
        // axios.get(`/api/repositories/${this.$route.params.name}/status`)
        axios.get(`/api/repositories/cc/status`)
          .then(response => {
            this.repositoryName = this.$route.params.name;
            this.commits=response.data;
          })
          .catch(error => console.error(error));
      }
    }
  };
  </script>
  